package com.power.project.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.project.model.ha_manage;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 管理员表 持久层(hibernate)
 */

public interface Ha_manageDao extends JpaRepository<ha_manage, Serializable>, JpaSpecificationExecutor<ha_manage>, Repository<ha_manage, Serializable>, Ha_mangeDaoCustom<ha_manage, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from ha_manage s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);

   ha_manage findByUserid(String userid);

   @Query("SELECT s.userid FROM ha_manage s WHERE s.userid IN :userIds")
   List<String> findUseridByUseridIn(@Param("userIds")List<String> userIds);

   void deleteByUserid(String tagerUserId);

}
